package find.chat.test;

import android.app.Activity;
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
import android.test.suitebuilder.annotation.SmallTest;
import find.chat.Login;
import find.chat.SignUp;
import find.chat.FriendList;
import find.chat.R;
import android.view.KeyEvent;
import android.view.Menu;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.test.TouchUtils;
import android.test.ActivityInstrumentationTestCase2;

public class signup extends ActivityInstrumentationTestCase2<SignUp> {
	private SignUp mActivity;
	Button signup,cancel;
	EditText username, passward,passwordAgain,eMail,hobbies,genderText;
	private Instrumentation.ActivityMonitor mBrowserActivityMonitor;
	public signup() {
		super(SignUp.class);
	}

	protected void setUp() throws Exception {
		// this method is called every time before any test execution
		super.setUp();

		mActivity = (SignUp) getActivity(); // get current activity
		signup = (Button) mActivity.findViewById(find.chat.R.id.signUp);
		cancel = (Button) mActivity.findViewById(find.chat.R.id.cancel_login);
		genderText = (EditText) mActivity.findViewById(find.chat.R.id.gender);
		username = (EditText) mActivity.findViewById(find.chat.R.id.userName);
		passward = (EditText) mActivity.findViewById(find.chat.R.id.password);
		passwordAgain = (EditText) mActivity.findViewById(R.id.passwordAgain);
		hobbies = (EditText) mActivity.findViewById(R.id.hobbies);
		eMail = (EditText) mActivity.findViewById(R.id.email);
		mBrowserActivityMonitor = new Instrumentation.ActivityMonitor(FriendList.class.getName(), null, false);
	    getInstrumentation().addMonitor(mBrowserActivityMonitor);
		// link the objects with the activity objects

	}

	@SmallTest
	// SmallTest: this test doesn't interact with any file system or network.
	public void testView() { // checks if the activity is created
		assertNotNull(getActivity());
	}

	public void testingfull() {
		TouchUtils.tapView(this, username);
		sendKeys("P E T E R");
		TouchUtils.tapView(this, passward);
		sendKeys("1 2 3 4 5");
		TouchUtils.tapView(this, passwordAgain);
		sendKeys("1 2 3 4 5");
		TouchUtils.tapView(this, eMail);
		sendKeys("1 H H");
		TouchUtils.dragQuarterScreenUp(this, mActivity);
		TouchUtils.dragQuarterScreenUp(this, mActivity);
		TouchUtils.dragQuarterScreenUp(this, mActivity);
		TouchUtils.tapView(this, hobbies);
		sendKeys("F O O T");
		TouchUtils.tapView(this, genderText);
		sendKeys("M");
	    TouchUtils.clickView(this, signup);
		assertEquals("peter",username.getText().toString());
		}
}

